package cn.iocoder.yudao.module.reservation.dal.mysql.accountbalance;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.reservation.dal.dataobject.accountbalance.AccountBalanceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.reservation.controller.admin.accountbalance.vo.*;

/**
 * 会员余额 Mapper
 *
 * @author yy
 */
@Mapper
public interface AccountBalanceMapper extends BaseMapperX<AccountBalanceDO> {

    default PageResult<AccountBalanceDO> selectPage(AccountBalancePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccountBalanceDO>()
                .eqIfPresent(AccountBalanceDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(AccountBalanceDO::getTotalBalance, reqVO.getTotalBalance())
                .eqIfPresent(AccountBalanceDO::getCashBalance, reqVO.getCashBalance())
                .eqIfPresent(AccountBalanceDO::getGiftBalance, reqVO.getGiftBalance())
                .betweenIfPresent(AccountBalanceDO::getLastUpdate, reqVO.getLastUpdate())
                .orderByDesc(AccountBalanceDO::getId));
    }

}